package config

import (
	"com.yy.api/common/config"
	"fmt"
	"os"
	"path/filepath"
	"runtime"
)

var (
	AppPort string
	cfg     *config.Config
)

func init() {
	_, currentFilePath, _, _ := runtime.Caller(0)
	currentDir := filepath.Join(filepath.Dir(currentFilePath))
	fmt.Printf("%v", currentDir)
	env := os.Getenv("APP_ENV")
	if env == "prod" {
		cfg = config.LoadConfig(currentDir, "app-prod")
	} else {
		cfg = config.LoadConfig(currentDir)
	}
	AppPort = cfg.LoadAppConfig().GetPort()
}
